import 'dart:convert';

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:light_image/commom/commom.dart';
import 'package:light_image/pages/login_page.dart';
import 'package:light_image/widget/view/wave_widget.dart';
import 'package:light_image/widget/view/web_view_page.dart';
import 'package:shared_preferences/shared_preferences.dart';

class MyPage extends StatefulWidget {
  MyPage({Key key, this.title}) : super(key: key);
  // This widget is the home page of your application. It is stateful, meaning
  //这个小部件是应用程序的主页。它是有状态的，意思是
  // that it has a State object (defined below) that contains fields that affect
  //它有一个State对象（定义如下），该对象包含影响
  // how it looks.
  //看起来怎么样。
  // This class is the configuration for the state. It holds the values (in this
  //这个类是状态的配置。它保存的值（在这个
  // case the title) provided by the parent (in this case the App widget) and
//case the title）由父程序（在本例中是App小部件）提供，并且
  // used by the build method of the State. Fields in a Widget subclass are
  //由状态的生成方法使用。小部件子类中的字段是
  // always marked "final".
//始终标记为“最终”
  final String title;
  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyPage> {
  @override
  void initState() {
    super.initState();
  }

  void _incrementCounter() {
    var url = 'https://lizhanqi.gitee.io/mysite/AppUseIndex/useindex.html';

    url = 'https://www.ixigua.com/';
    routePush(new WebViewPage(url, '未知'));
//    launch('https://github.com/ahyangnb/ncov_2019');
  }

  void  logout()async{
    SharedPreferences prefs = await SharedPreferences.getInstance();
    prefs.setString('phone', "");
    pushAndRemoveUntil(LoginPage(), RouterType.material);
  }

  //相当于xml页面构建
  @override
  Widget build(BuildContext context) {
    var ls=  List<Color>(  );
    var ls1=  List<Color>(  );
//    List<Color>[0]=Color(0xffb7c8ff);
//    ls.add(Color(0xffb7c8ff));
    ls.add(Color(0x26000000));
//     ls1.add(Colors.white);
         return
           Stack(
               children: <Widget>[
           Column(
      children: <Widget>[
         Container(
           height: 100,
           decoration: BoxDecoration(
             gradient: LinearGradient(
               begin: Alignment.topLeft,
               end: Alignment.bottomRight,
             colors: [         Color.fromARGB(255,138,126,255), Color.fromARGB(255,120,168,255)
             ],
    )),
    ),

          ],
        ), Align(
                   alignment: Alignment(0,0),
                     child: Container(
                         child:
                         Stack(
                             children: <Widget>[
//            ProgressManager(ls1) ,
                               ProgressManager(ls) ,
                             ])

                     ) )
               ]
    );

  }
}
